<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<%@include file="/common/admin_common.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>文章管理</title>
		<script type="text/javascript" src="${ctx}/js/page.js"></script>
	</head>
	<body style="background-image: none;">

		<div class="content-box">
			<!-- Start Content Box -->
			<div class="content-box-header">
				<h3>
					文章管理
				</h3>
				<ul class="content-box-tabs">
					<li>
						<a href="#tab1" class="default-tab">文章信息列表</a>
					</li>
					<!-- href must be unique and match the id of target div -->
					<li>
						<a href="#tab2">创建新文章</a>
					</li>
				</ul>
				<div class="clear"></div>
			</div>
			<!-- End .content-box-header -->
			<div class="content-box-content">
				<div class="tab-content default-tab" id="tab1">
					<s:action name="getArticleList" namespace="/admin"></s:action>
					<!-- This is the target div. id must match the href of this div's tab -->
					<div class="notification attention png_bg">
						<a href="#" class="close"><img
								src="${ctx}/images/icons/cross_grey_small.png"
								title="Close this notification" alt="close" /> </a>
						<div>
							<form action="${ctx}/admin/article/searchby" method="get">
								<input type="hidden" name="currentPage" value="1">
								导航名
								<select style="width: 140px" id="navid2" name="navid"></select>
								时间
								<input type="text" name="pubtime" />
								关键字
								<input type="text" value="${keyword}" name="keyword" />
								<input type="submit" value="查询" />
								<input type="button" value="查询全部" onclick="searchAll()" />
							</form>
						</div>
					</div>
					<table class="table">

						<thead class="thead">
							<tr>
								<th>
									<input class="check-all" type="checkbox" />
								</th>
								<th>
									序号
								</th>
								<th>
									文章标题
								</th>
								<th>
									关键字
								</th>
								<th>
									文章描述
								</th>
								<th>
									创建时间
								</th>
								<th>
									操作
								</th>
							</tr>

						</thead>

						<tfoot>

							<tr>
								<td colspan="7">
									<br />
									<div class="bulk-actions align-left">
										<a class="button" href="javascript:delByIds('${ctx}');">删除选定</a>
									</div>
									<!-- 分页信息 -->
									<div class="pagination">
										<c:if test="${pm.result ne null}">
											<script>
													var pg = new showPages('pg');
													pg.pageCount = ${pm.maxPage};
													pg.argName = 'currentPage';
													pg.printHtml();  
												</script>
										</c:if>
									</div>
									<!-- End .pagination -->
									<div class="clear"></div>
								</td>
							</tr>
						</tfoot>
						<!-- 数据展示 -->
						<tbody id="datalist">
							<c:choose>
								<c:when test="${pm.result eq null}">
									<tr>
										<td colspan="7">
											没有文章分类信息，请先添加
										</td>
									</tr>
								</c:when>
								<c:otherwise>
									<c:forEach var="article" items="${pm.result}"
										varStatus="status">
										<tr id="${article.articleId}">
											<td>
												<input type="checkbox" name="xidx"
													value="${article.articleId}" />
											</td>
											<td>
												${status.index+1}
											</td>
											<td>
												${fn:substring(article.articleTitle,0,10)}
											</td>
											<td>
												${fn:substring(article.articleKeywords,0,4)}
											</td>
											<td>
												${fn:substring(fht:delHTMLTag(article.articleContent),0,12)}...
											</td>
											<td>
												<fmt:formatDate value="${article.articleCreateTime}"
													pattern="yyyy/MM/dd" />
											</td>
											<td>
												<!-- Icons -->
												<a href="javascript:delById('${ctx}',${article.articleId});"
													title="删除文章分类信息"><img
														src="${ctx}/images/icons/cross.png" alt="删除文章分类信息" /> </a>
												<a href="javascript:edit('${ctx}',${article.articleId})"
													title="修改文章分类信息"><img
														src="${ctx}/images/icons/hammer_screwdriver.png"
														alt="修改文章分类信息" /> </a>
											</td>
										</tr>
									</c:forEach>
								</c:otherwise>
							</c:choose>

						</tbody>

					</table>
				</div>
				<!-- End #tab1 -->
				<div class="tab-content" id="tab2">

					<fieldset>
						<form action="${ctx}/admin/article/add" method="post"
							id="mainform">
							<input type="hidden" name="a.id" value="0" id="articleid" />
							<input type="hidden" name="articlefile" value="0"
								id="articlefile" />
							<!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
							<p>
								<label style="color: red;">
									文章标题：
								</label>
								<input class="text-input small-input" type="text" id="title"
									name="a.title" />
								<select id="color" name="color">
									<option value="0">
										默认
									</option>
									<option value="1">
										红色
									</option>
									<option value="2">
										绿色
									</option>
									<option value="3">
										蓝色
									</option>

								</select>
								<span class="input-notification attention png_bg">输入文章的标题信息</span>
								<!-- Classes for input-notification: success, error, information, attention -->
								<br />
							</p>
							<p>
								<label>
									&nbsp;&nbsp;&nbsp;关键字：
								</label>
								<input class="text-input Medium-input" type="text" id="keywords"
									name="a.keywords" />
								<span class="input-notification information png_bg">文章的关键字
									信息</span>
								<!-- Classes for input-notification: success, error, information, attention -->
								<br />
							</p>
							<p>
								<label>
									文章来源：
								</label>
								<input class="text-input Medium-input" type="text" id="source"
									name="a.source" />
								<span class="input-notification information png_bg">文章的来源信息,如：原创、转载等</span>
								<!-- Classes for input-notification: success, error, information, attention -->
								<br />
							</p>
							<p>
								<label>
									&nbsp;&nbsp;&nbsp;发布者：
								</label>
								<input class="text-input Medium-input" type="text" id="author"
									name="a.author" />
								<span class="input-notification information png_bg">文章的发布人或者是作者</span>
								<!-- Classes for input-notification: success, error, information, attention -->
								<br />
							</p>
							<p>
								<label>
									发布日期：
								</label>
								<input class="text-input Medium-input" type="text"
									id="createDate" name="a.createDate" />
								<span class="input-notification information png_bg">本网站发布文章的日期</span>
								<!-- Classes for input-notification: success, error, information, attention -->
								<br />
							</p>
							<p>
								<label>
									&nbsp;&nbsp;&nbsp;点击率：
								</label>
								<input class="text-input Medium-input" type="text" id="click"
									name="a.click" />
								<span class="input-notification information png_bg">文章被浏览的次数</span>
								<!-- Classes for input-notification: success, error, information, attention -->
								<br />
							</p>
							<p>
								<label style="color: red;">
									首页显示：
								</label>
								<input type="checkbox" name="a.top" id="top" value="true" />
								显示
								<span class="input-notification attention png_bg">设置这篇文章是否在首页显示</span>
								<!-- Classes for input-notification: success, error, information, attention -->
								<br />
							</p>
							<p>
								<label style="color: red;">
									文章显示：
								</label>
								<input type="checkbox" name="a.show" id="show" checked="checked"
									value="true" />
								显示
								<span class="input-notification attention png_bg">设置这篇文章是否在网站中显示</span>
								<br />
							</p>
							<p>
								<label style="color: red;">
									图片新闻：
								</label>
								<input type="checkbox" name="a.hasPic" id="hasPic" value="true" />
								是
								<span class="input-notification attention png_bg">设置这篇文章是否是图片新闻的显示样式</span>
								<br />
							</p>
							<p>
								<label style="color: red;">
									审核状态：
								</label>
								<input type="checkbox" name="a.shenhe" value="true" id="shenhe" />
								已审核
								<span class="input-notification attention png_bg">管理员是否同意这篇文章的申请</span>
								<br />
							</p>
							<!-- 
									<p>
										<label style="color: red;">
											文章分类：
										</label>
										<select name="a.typeid" id="typeid">
											<option value="0">---无分类---</option>
										</select>
										<span class="input-notification attention png_bg">管理员自定义的文章分类</span>
										<br/>
									</p>
									 -->
							<p>
								<label style="color: red;">
									显示风格：
								</label>
								<select name="a.styleid" id="styleid">
									<option value="0">
										---请选择---
									</option>
								</select>
								<span class="input-notification attention png_bg">
									文章内容在网站上展示的风格</span>
								<br />
							</p>
							<p>
								<label style="color: red;">
									文章内容：
								</label>
								<fck:editor instanceName="a.content" width="900" height="600">

								</fck:editor>
								<br />
							</p>
							<p>
								<input class="button" type="submit" value="保存" />
							</p>
						</form>
						<form method="post" action="${ctx}/admin/article/upload" enctype="multipart/form-data" id="fileupload">
									<p>
										<label>
											附件：
										</label>
										<input class="multi" maxlength="5"  type="file" id="articlefile" name="articlefile" />
										<span class="input-notification information png_bg" id="tip">最多可以上传5个文件</span>
										<input  class="button" type="submit" value="上传"/>
										<!-- Classes for input-notification: success, error, information, attention -->
										<br />
									</p>
						</form>
					</fieldset>

					<div class="clear"></div>
					<!-- End .clear -->

				</div>
				<!-- End #tab2 -->
			</div>
			<!-- End .content-box-content -->
		</div>
		<!-- End .content-box -->
		<jsp:include page="foot.jsp" flush="true"></jsp:include>
	</body>
</html>
